package myky.com.doctorapp.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import myky.com.doctorapp.R
import myky.com.doctorapp.entity.DepatmentAndAreaEntity

/**
 * Title:医生列表子科室的适配器
 * Description: TODO
 * @author xiangyao
 * date 2019/1/16
 */
class DoctorLisDepartmentCHAdapter(mDepartmentChList: MutableList<DepatmentAndAreaEntity.DataEntity.DepartmentEntity.DepartmentchildEntity>) :

        BaseQuickAdapter<DepatmentAndAreaEntity.DataEntity.DepartmentEntity.DepartmentchildEntity, BaseViewHolder>(R.layout.department_child_item, mDepartmentChList) {

    var selectedDepartmentCHA: String = ""


    fun setDepartmentCHA(province: String) {
        this.selectedDepartmentCHA = province
    }


    override fun convert(holder: BaseViewHolder, item: DepatmentAndAreaEntity.DataEntity.DepartmentEntity.DepartmentchildEntity) {

        val departmentName = item.departmentchildname

        holder.setText(R.id.departmentChildTextView, departmentName)

        if (departmentName.equals(selectedDepartmentCHA)) {
            holder.setTextColor(R.id.departmentChildTextView, mContext.resources.getColor(R.color.theme_app))
        } else {
            holder.setTextColor(R.id.departmentChildTextView, mContext.resources.getColor(R.color.gray_222222))
        }

        holder.addOnClickListener(R.id.departmentChildLlayout)
    }
}